<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ include file="/common/taglibs.jsp" %>

<script type="text/javascript">
    function changeCurrent(id, menuname, url) {
        if ('退出系统' == menuname) {//退出系统的场合
            $.dialog({
                icon: 'question',
                title: '确认',
                lock: true,
                width: '200px',
                content: '确定要退出吗?',
                ok: function () {
                    self.location = url;
                },
                cancel: function () {
                }
            });
        } else if ('客户地图' == menuname || '图表首页' == menuname) {
            window.open(url + "?menuid=" + id);
        } else {
            self.location = url + "?menuid=" + id;
        }
    }
    $(function () {
        $('.fist_menu').click(function () {
            console.log("11");
            $(this).siblings().children('div').hide();
            $(this).children('div').toggle();
        });

        var menuid = eval('${menuid }');
        $("[id='"+menuid+"']~ div").show();
    })
</script>
<div class="main-left">
    <div id="levelmenu">
        <div class="title_menu">
            <span class="account"><img src="${cdnctx}/src/menu/系统菜单.png">系统菜单</span>
        </div>
        <c:forEach items="${leftmenus}" var="entity" varStatus="status">
            <div class="fist_menu">
                <span id="${entity.menuid}"
                      onclick="${entity.menumethod};changeCurrent('${entity.menuid}','${entity.menuname}','${cdnctx}${entity.menupath}')">
                    <img src="${cdnctx}/src/menu/${entity.menuname}.png">${entity.menuname}</span>
                <c:forEach items="${entity.childMenus}" var="menu" varStatus="status">
                    <div class="second_menu" style="height:28px;display:none;">
                        <span onclick="${menu.menumethod};changeCurrent('${menu.menuid}','${menu.menuname}','${cdnctx}${menu.menupath}')">&nbsp;&nbsp;&nbsp;&nbsp;${menu.menuname}</span>
                    </div>
                </c:forEach>
            </div>
        </c:forEach>
    </div>
</div>